#include "UdpServer.hpp"
#include "Comm.hpp"
#include <iostream>
#include <memory>

//
std::string Route(std::string massage)
{
    return massage + "you !!!!!!!!!!!";
}

void Usage(std::string proc)
{
    std::cout << "Usage : \n\t" << proc << " local_port" << std::endl;
    exit(Usage_Err);
}

int main(int argc, char *argv[])
{

    // ./UdpServer 0.0.0.0 8888
    if (argc != 2)
    {
        Usage(argv[0]);
    }
    // std::string ip = argv[1];
    uint16_t port = std::atoi(argv[1]);
    // std::shared_ptr<UdpServer> usvr = std::make_shared<UdpServer>(ip,port);
    std::shared_ptr<UdpServer> usvr = std::make_shared<UdpServer>(Route, port);
    // UdpServer* usvr = new UdpServer();
    usvr->Init();
    usvr->Start();
    return 0;
}